$(function () {
    $("#jqGrid").jqGrid({
        url: '../merchantLogs/LoginLogs',
        datatype: "json",
        colModel: [
            { label: 'id', name: 'id', width: 30, key: true },
            { label: '用户名', name: 'username', width: 50 },
            { label: '角色', name: 'rolename', width: 50 },
            { label: '手机号码', name: 'mobile', width: 70 },
            { label: '验证码', name: 'codeNo', width: 50 },
            { label: '登录IP', name: 'lastLoginIp',index:"last_login_ip", width: 70 },
            { label: '商户编码', name: 'merchantNo', width: 80 },
            { label: '店铺名称', name: 'shopname', width: 110 },
            { label: '登录时间', name: 'lastLoginTime',index:"last_login_time", width: 90 }
        ],
        viewrecords: true,
        height: 'auto',
        rowNum: 10,
        rowList : [10,20,30],
        rownumbers: true,
        rownumWidth: 25,
        autowidth:true,
        multiselect: false,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page",
            rows:"limit",
            order: "order"
        },
        gridComplete:function(){
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
        }
    });
});

var vm = new Vue({
    el:'#rrapp',
    data:{
        mobile:"",
        merchantNo: "",
        shopname:""
    },
    methods: {
        query: function () {
            vm.reload();
        },
        reload: function (event) {
            var page = $("#jqGrid").jqGrid('getGridParam','page');
            page = 1;
            $("#jqGrid").jqGrid('setGridParam',{
                postData:{'mobile':vm.mobile,'merchantNo': vm.merchantNo,'shopname':vm.shopname},
                page:page
            }).trigger("reloadGrid");
        }
    }
});